package Formularios;

import BD.Usuarios;
import Formularios.FormCaixa;
import Formularios.FormClientes;
import Formularios.FormCompras;
import Formularios.FormFornecedor;
import Formularios.FormFuncionarios;
import Formularios.FormPedidos;
import Formularios.FormPizzas;
import Formularios.FormProduto;
import Formularios.FormSabores;
import Formularios.FormUsuarios;
import javax.swing.JOptionPane;

/**
 *
 * @author Gusttavo
 */
public class FormPrincipal extends javax.swing.JFrame {

    Usuarios use = new Usuarios();
    String useSemper = "Usuário sem permissão para essa Operação";
    String Titulo = "Master Pizza - Sistema de Pizzaria";

    /**
     * Creates new form main
     */
    public FormPrincipal() {
        initComponents();
        setLocationRelativeTo(null);
        labelImagem.setVisible(false);
        jPnlLogin.setVisible(true);
        menuBarra.setVisible(false);
//        CarregarLogin();
        return;
        /*setTitle(Titulo);
         labelImagem.setVisible(false);
         jPnlLogin.setVisible(true);
         menuBarra.setVisible(false);*/
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelImagem = new javax.swing.JLabel();
        jPnlLogin = new javax.swing.JPanel();
        IconeLogin = new javax.swing.JLabel();
        jtSenha = new javax.swing.JPasswordField();
        Senha = new javax.swing.JLabel();
        textoLogin = new javax.swing.JTextField();
        Usuario = new javax.swing.JLabel();
        botaoEntrar = new javax.swing.JButton();
        jbtncancelar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        menuBarra = new javax.swing.JMenuBar();
        menuCadastro = new javax.swing.JMenu();
        menuCliente = new javax.swing.JMenuItem();
        menuFornecedor = new javax.swing.JMenuItem();
        menuFuncionario = new javax.swing.JMenuItem();
        menuProdutos = new javax.swing.JMenuItem();
        menuSabores = new javax.swing.JMenuItem();
        menuPizzas = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        separador = new javax.swing.JPopupMenu.Separator();
        menuSair = new javax.swing.JMenuItem();
        menuLancamento = new javax.swing.JMenu();
        menuVendas = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        menuCompras = new javax.swing.JMenuItem();
        menuInformacao = new javax.swing.JMenu();
        menuSobre = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Master Pizza - Sistema de Pizzaria");

        labelImagem.setFont(new java.awt.Font("Vijaya", 0, 36)); // NOI18N
        labelImagem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Pizzaria.png"))); // NOI18N

        jPnlLogin.setBorder(new javax.swing.border.MatteBorder(null));

        IconeLogin.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        IconeLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/login_icon.png"))); // NOI18N

        jtSenha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtSenhaActionPerformed(evt);
            }
        });

        Senha.setText("Senha");

        Usuario.setText("Usuário");

        botaoEntrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Gravar.png"))); // NOI18N
        botaoEntrar.setText("Entrar");
        botaoEntrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                botaoEntrarActionPerformed(evt);
            }
        });

        jbtncancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Cancelar.png"))); // NOI18N
        jbtncancelar.setText("Cancelar");
        jbtncancelar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtncancelarActionPerformed(evt);
            }
        });

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Logo.png"))); // NOI18N

        javax.swing.GroupLayout jPnlLoginLayout = new javax.swing.GroupLayout(jPnlLogin);
        jPnlLogin.setLayout(jPnlLoginLayout);
        jPnlLoginLayout.setHorizontalGroup(
            jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPnlLoginLayout.createSequentialGroup()
                .addComponent(IconeLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPnlLoginLayout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(botaoEntrar)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jbtncancelar))
                    .addGroup(jPnlLoginLayout.createSequentialGroup()
                        .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnlLoginLayout.createSequentialGroup()
                                .addComponent(Usuario)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
                            .addGroup(jPnlLoginLayout.createSequentialGroup()
                                .addComponent(Senha)
                                .addGap(8, 8, 8)))
                        .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jtSenha)
                            .addComponent(textoLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPnlLoginLayout.setVerticalGroup(
            jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(IconeLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPnlLoginLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(textoLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Usuario))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Senha))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(botaoEntrar)
                    .addComponent(jbtncancelar))
                .addContainerGap())
        );

        menuCadastro.setText("Cadastros");

        menuCliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/cliente.png"))); // NOI18N
        menuCliente.setText("Clientes");
        menuCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuClienteActionPerformed(evt);
            }
        });
        menuCadastro.add(menuCliente);

        menuFornecedor.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuFornecedor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Fornecedores.png"))); // NOI18N
        menuFornecedor.setText("Fornecedores");
        menuFornecedor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuFornecedorActionPerformed(evt);
            }
        });
        menuCadastro.add(menuFornecedor);

        menuFuncionario.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/funcionario.png"))); // NOI18N
        menuFuncionario.setText("Funcionários");
        menuFuncionario.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuFuncionarioActionPerformed(evt);
            }
        });
        menuCadastro.add(menuFuncionario);

        menuProdutos.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuProdutos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Produto.png"))); // NOI18N
        menuProdutos.setText("Produtos");
        menuProdutos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuProdutosActionPerformed(evt);
            }
        });
        menuCadastro.add(menuProdutos);

        menuSabores.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuSabores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Sabores.png"))); // NOI18N
        menuSabores.setText("Sabores");
        menuSabores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSaboresActionPerformed(evt);
            }
        });
        menuCadastro.add(menuSabores);

        menuPizzas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        menuPizzas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Pizza.png"))); // NOI18N
        menuPizzas.setText("Pizzas");
        menuPizzas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuPizzasActionPerformed(evt);
            }
        });
        menuCadastro.add(menuPizzas);

        jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_G, java.awt.event.InputEvent.SHIFT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/funcionario.png"))); // NOI18N
        jMenuItem3.setText("Usuário");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        menuCadastro.add(jMenuItem3);
        menuCadastro.add(separador);

        menuSair.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, java.awt.event.InputEvent.CTRL_MASK));
        menuSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Cancelar.png"))); // NOI18N
        menuSair.setText("Sair");
        menuSair.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSairActionPerformed(evt);
            }
        });
        menuCadastro.add(menuSair);

        menuBarra.add(menuCadastro);

        menuLancamento.setText("Lançamentos");

        menuVendas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.SHIFT_MASK));
        menuVendas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Caixa.png"))); // NOI18N
        menuVendas.setText("Caixa");
        menuVendas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuVendasActionPerformed(evt);
            }
        });
        menuLancamento.add(menuVendas);

        jMenu1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Sabores.png"))); // NOI18N
        jMenu1.setText("Pedido e Vendas");

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Mesa.png"))); // NOI18N
        jMenuItem1.setText("Mesa");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem1);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.SHIFT_MASK));
        jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/Entrega.png"))); // NOI18N
        jMenuItem2.setText("Entrega");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        menuLancamento.add(jMenu1);

        menuCompras.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.SHIFT_MASK));
        menuCompras.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/carrinho.png"))); // NOI18N
        menuCompras.setText("Compras");
        menuCompras.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuComprasActionPerformed(evt);
            }
        });
        menuLancamento.add(menuCompras);

        menuBarra.add(menuLancamento);

        menuInformacao.setText("Informações");

        menuSobre.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.CTRL_MASK));
        menuSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Icones/icone_about2.png"))); // NOI18N
        menuSobre.setText("Sobre");
        menuSobre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSobreActionPerformed(evt);
            }
        });
        menuInformacao.add(menuSobre);

        menuBarra.add(menuInformacao);

        setJMenuBar(menuBarra);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(98, Short.MAX_VALUE)
                .addComponent(labelImagem)
                .addGap(58, 58, 58))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(157, 157, 157)
                    .addComponent(jPnlLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(148, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(59, 59, 59)
                .addComponent(labelImagem)
                .addContainerGap(66, Short.MAX_VALUE))
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(177, 177, 177)
                    .addComponent(jPnlLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGap(177, 177, 177)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        if (!this.use.isGerente() && !this.use.isGarcom()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormPedidos forms = new FormPedidos(2);
        forms.TIPOTELA = 2;
        forms.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        if (!this.use.isGerente() && !this.use.isGarcom()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormPedidos forms = new FormPedidos(1);
        forms.TIPOTELA = 1;
        forms.setVisible(true);
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void menuClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuClienteActionPerformed
        if (!this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormClientes cli = new FormClientes();
        cli.setVisible(true);
    }//GEN-LAST:event_menuClienteActionPerformed

    private void menuFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFornecedorActionPerformed
        if (!this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormFornecedor fornec = new FormFornecedor();
        fornec.setVisible(true);
    }//GEN-LAST:event_menuFornecedorActionPerformed

    private void menuFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFuncionarioActionPerformed
        if (!this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormFuncionarios func = new FormFuncionarios();
        func.setVisible(true);
    }//GEN-LAST:event_menuFuncionarioActionPerformed

    private void menuProdutosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuProdutosActionPerformed
        if (!this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }

        FormProduto prod = new FormProduto();
        prod.setVisible(true);
    }//GEN-LAST:event_menuProdutosActionPerformed

    private void menuVendasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuVendasActionPerformed
        if (!this.use.isGerente() && !this.use.isCaixa()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormCaixa cax = new FormCaixa();
        cax.use = this.use;
        cax.setVisible(true);
    }//GEN-LAST:event_menuVendasActionPerformed

    private void menuSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSobreActionPerformed
        JOptionPane.showMessageDialog(null, "        ...::: Master Pizza :::...\n"
                + "Sistema de Pizzaria Versão\n"
                + "Todos os Direitos Reservados !");
    }//GEN-LAST:event_menuSobreActionPerformed

    private void menuSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSairActionPerformed
        if(JOptionPane.showConfirmDialog(null,"Deseja fechar a aplicação?")==0)
            System.exit(0);
    }//GEN-LAST:event_menuSairActionPerformed

    private void menuComprasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuComprasActionPerformed
        if (!this.use.isPizzaiolo() && !this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormCompras cp = new FormCompras();
        cp.setVisible(true);
    }//GEN-LAST:event_menuComprasActionPerformed

    private void menuSaboresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSaboresActionPerformed
        if (!this.use.isGerente() && !this.use.isPizzaiolo()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormSabores sab = new FormSabores();
        sab.setVisible(true);
    }//GEN-LAST:event_menuSaboresActionPerformed

    private void menuPizzasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuPizzasActionPerformed
        if (!this.use.isGerente() && !this.use.isPizzaiolo()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormPizzas pizza = new FormPizzas();
        pizza.setVisible(true);
    }//GEN-LAST:event_menuPizzasActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        if (!this.use.isGerente()) {
            JOptionPane.showMessageDialog(menuCompras, useSemper);
            return;
        }
        FormUsuarios log = new FormUsuarios();
        log.setVisible(true);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jtSenhaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtSenhaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jtSenhaActionPerformed

    private void botaoEntrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_botaoEntrarActionPerformed

        CarregarLogin();
    }//GEN-LAST:event_botaoEntrarActionPerformed

    private void CarregarLogin() {

        if (textoLogin.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Favor informe o Usuario!");
            return;
        }
        if (jtSenha.getText().equals("")) {
            JOptionPane.showMessageDialog(null, "Favor informe a Senha!");
            return;
        }

        use.setNome(textoLogin.getText());
        use.setSenha(jtSenha.getText());
        if (use.getItens().size() <= 0) {
            JOptionPane.showMessageDialog(null, "Usuário e senha incorretos. Verifique! ");
            return;
        }

        use = use.getItens().get(0);
        labelImagem.setVisible(true);
        jPnlLogin.setVisible(false);
        menuBarra.setVisible(true);

        this.setTitle(Titulo + "- Usuário: " + use.getNome());

        textoLogin.setText("");
        jtSenha.setText("");
        
        if(use.isCaixa() && !use.isGarcom() && !use.isGerente() && !use.isPizzaiolo()){
            menuVendasActionPerformed(null);
        }

    }

    private void jbtncancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtncancelarActionPerformed

        System.exit(0);
    }//GEN-LAST:event_jbtncancelarActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FormPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new FormPrincipal().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel IconeLogin;
    private javax.swing.JLabel Senha;
    private javax.swing.JLabel Usuario;
    private javax.swing.JButton botaoEntrar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JPanel jPnlLogin;
    private javax.swing.JButton jbtncancelar;
    private javax.swing.JPasswordField jtSenha;
    private javax.swing.JLabel labelImagem;
    private javax.swing.JMenuBar menuBarra;
    private javax.swing.JMenu menuCadastro;
    private javax.swing.JMenuItem menuCliente;
    private javax.swing.JMenuItem menuCompras;
    private javax.swing.JMenuItem menuFornecedor;
    private javax.swing.JMenuItem menuFuncionario;
    private javax.swing.JMenu menuInformacao;
    private javax.swing.JMenu menuLancamento;
    private javax.swing.JMenuItem menuPizzas;
    private javax.swing.JMenuItem menuProdutos;
    private javax.swing.JMenuItem menuSabores;
    private javax.swing.JMenuItem menuSair;
    private javax.swing.JMenuItem menuSobre;
    private javax.swing.JMenuItem menuVendas;
    private javax.swing.JPopupMenu.Separator separador;
    private javax.swing.JTextField textoLogin;
    // End of variables declaration//GEN-END:variables
}
